#include <stdio.h>

void insert(int arr[],int n,int k){
    int i = n-1;
    while(i+1){
        if(k<=arr[i]){
            arr[i+1] = arr[i];
            arr[i] = k;
            i--;
        }
        else break;
    }
}


int main(){
    int n;
    scanf("%d",&n);
    int size = n+1;
    int arr[size];
    for(int i;i<n;i++){
        scanf("%d",&arr[i]);
    }
    int key;
    scanf("%d",&key);

    insert(arr,n,key);//判断并插入函数

    for(int i = 0;i<n+1;i++){
        printf(" %d",arr[i]);
    }

    return 0;
}